package com.bqtv.sport.commen.utils

class HtmlFormatUtils {
    companion object{
        /**
         * 富文本适配
         *
         * @param bodyHTML
         * @return
         */
        fun getHtmlData(bodyHTML: String?): String? {
            var bodyHTML = bodyHTML
            if (bodyHTML == null) {
                bodyHTML = ""
            }
            val head = ("<head>"
                    + "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no\"> "
                    + "<style>img{max-width: 100%; width:auto; height:auto;}</style>"
                    + "</head>")
            return "<html>$head<body style='margin:0;padding:0'><font color= '#585858' style= “BACKGROUND-COLOR:#00000000”>$bodyHTML</font></body></html>"
        }
        /**
         * 富文本适配
         *
         * @param bodyHTML
         * @return
         */
        fun getHtmlDataPadding(bodyHTML: String?): String? {
            var bodyHTML = bodyHTML
            if (bodyHTML == null) {
                bodyHTML = ""
            }
            val head = ("<head>"
                    + "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no\"> "
                    + "<style>img{max-width: 100%; width:auto; height:auto;}</style>"
                    + "</head>")
            return "<html>$head<body style='margin:0;padding:15'><font color= '#585858' style= “BACKGROUND-COLOR:#00000000”>$bodyHTML</font></body></html>"
        }
    }
}